Terminate read buffer.
authoroliskoli <oliskoli>
Mon, 27 Nov 2006 23:43:24 +0000 (23:43 +0000)
committeroliskoli <oliskoli>
Mon, 27 Nov 2006 23:43:24 +0000 (23:43 +0000)
coastexp.c

index 8da17a061530613fe4693624ec1cdb0613f5e6df..acb70996e231e398536beb3f5250b0ed51c479a3 100755 (executable)
@@ -332,9 +332,10 @@ void
 ce_read(void)
 {
        int len;
-       char buf[MY_CBUF];
+       char buf[MY_CBUF + 1];
 
-       while ((len = gbfread(buf, 1, sizeof(buf), fd))) {
+       while ((len = gbfread(buf, 1, sizeof(buf) - 1, fd))) {
+               buf[len] = '\0';
                if (!XML_Parse(psr, buf, len, gbfeof(fd))) {
                        fatal(MYNAME ":Parse error at %d: %s\n",
                                (int) XML_GetCurrentLineNumber(psr),